#include "semafor2.h"
#include <iostream>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

static struct sembuf buf;

int podnies(int semid, int semnum){
        buf.sem_num = semnum;
        buf.sem_op = 1;
        buf.sem_flg = 0;
        if(semop(semid, &buf, 1) == -1){
                perror("podnies");
               exit(1);
        }
        return 0;
};

int opusc(int semid, int semnum){

        buf.sem_num = semnum;
        buf.sem_op = -1;
        buf.sem_flg = 0;

        if(semop(semid,&buf, 1) == -1){
                perror("opusc");
                exit(1);
        }
        return 0;
};

